<!---->
<div class="common_left COM_Search">

    <div class="Search_box">
        <form action="{:U('Search/index')}" method="post" id="form">
            <dl>
                <dt>搜索条件</dt>
                <dd><select style="width:98px" name="type" onchange="GetCatSelect(1)">
                        <option value="gezi" <eq name="type" value="gezi">selected</eq>>格子</option>
                        <option value="catad" <eq name="type" value="catad">selected</eq>>分类广告</option>
                        <option value="dazhe" <eq name="type" value="dazhe">selected</eq>>打折优惠</option>
                        <option value="service" <eq name="type" value="service">selected</eq>>生活服务</option>
                    </select>
                    <i id="cat_one"></i>
                    <select name="cate_one" style="display: none;" onchange="GetCatSelect(2)">
                        <option value="0">一级分类</option>
                    </select>
                    <i id="cat_two"></i>
                    <select name="cate_two" style="display: none;">
                        <option value="0">二级分类</option>
                    </select>      
                </dd>
            </dl>
            <dl>
                <dt>关键字</dt>
                <dd><input name="keyword" type="text" value="<if condition="$_POST['keyword']">{$_POST['keyword']}<else/>请输入关键字</if>"  onclick="value = '';
                        focus()"></dd>
            </dl>
            <dl>
                <dt>发布者</dt>
                <dd><input name="uname" type="text" value="<if condition="$_POST['uname']">{$_POST['uname']}<else/>请输入关键字</if>"  onclick="value = '';
                        focus()"></dd>
            </dl>
            <div class="but"><input type="image" name="imageField" src="__PUBLIC_HOME__/images/but1.jpg"></div>
        </form>
    </div>

    <div class="clear"></div>

    <div class="Search_title">{$stitle}-搜索结果：</div>
    <div class="clear"></div>


    <switch name="type">
    <case value="gezi">
        <ul class="Search_list">
            <volist name="data.list" id="lt">
                <li>
                    <div class="img"><img src="{$lt.s_img}"><p><a href="{:U('Link/jump', array('id', $lt['link_id']))}">{$stitle}</a></p></div>
                    <dl>
                        <dt><a href="{:U('Link/jump', array('id', $lt['link_id']))}">{$lt.title}</a></dt>
                        <dd>格子发布时间:{$lt.star_time|date="Y-m-d", ###}</dd>
                        <dd>格子到期时间:{$lt.end_time|date="Y-m-d", ###}</dd>
                    </dl>
                </li>     
            </volist>
        </ul>
    </case>



    <case value="catad">
        <ul class="Search_list">
            <volist name="data.list" id="lt">
                <li>
                    <div class="img"><img src="{$lt.main_img_url}"><p><a href="{:U('Link/jump', array('id', $lt['link_id']))}">{$stitle}</a></p></div>
                    <dl>
                        <dt><a href="{:U('Link/jump', array('id', $lt['link_id']))}">{$lt.title}</a></dt>
                        <dd>发布时间:{$lt.star_time|date="Y-m-d", ###}</dd>
                        <dd>到期时间:{$lt.end_time|date="Y-m-d", ###}</dd>
                    </dl>
                </li>     
            </volist>
        </ul>
    </case>


    <case value="dazhe">
        <ul class="Search_list">
            <volist name="data.list" id="lt">
                <li>
                    <div class="img"><img src="{$lt.img_url}"><p><a href="#">{$lt.cat_name}</a></p></div>
                    <dl>
                        <dt><a href="#">{$lt.description}</a></dt>
                        <dd>地址:{$lt.address}</dd>
                        <dd>电话：{$lt.phone}</dd>
                        <dd>时间：{$lt.star_time|date="Y-m-d", ###}</dd>
                        <dd  class="COL"><a href="javascript:favorite({$lt.dazhe_id}, 'dazhe');">我要收藏</a></dd>
                    </dl>
                </li> 
            </volist>
        </ul>
    </case>



    <case value="service">
        <div class="common_left COM_LifeService">
            <ul class="LifeService_list">
                <volist name="data.list" id="sr">
                    <li class="" style="background: url({$sr.background_url}) no-repeat scroll 0 0 transparent">
                        <div class="img"><img src="{$sr.pic_url}"></div>
                        <dl>
                            <dt><a href="{:U('Service/show', array('sid'=>$sr['service_id']))}">{$sr.name|str_cut="16,..."}</a></dt>
                            <dd>服务类别:{$sr.cat_name}</dd>
                            <dd>收费标准：{$sr.fee|str_cut="16,..."}</dd>
                            <dd>联系方式：{$sr.phone}  </dd>
                            <dd  class="COL"><a href="javascript:serviceGreat({$sr.service_id})"><i>{$sr.great_count|intval}</i>赞一个</a></dd>
                        </dl>
                    </li>
                </volist>  
            </ul>
        </div>
    </case>
    </switch>


    <div class="clear"></div>   
    <div class="paginationa">
        {$data.page}
    </div>




</div>
<!----> 
<div class="common_right">
    <div class="Cad">{:getBlock('common_right_ad1')}</div>
    <div class="Cad martop10">{:getBlock('common_right_ad2')}</div>
    <include file="Public:round" />
</div>
<script type="text/javascript">
    GetCatSelect(1);
    function GetCatSelect(sT) {
        if (sT == 1) {
            var type = $("select[name='type']").val();
            var pid = 0;
            var tp = 0;
        } else {
            var tp = $("select[name='type']").val();
            var pid = $("select[name='cate_one']").val();
            var type = 'child';
        }
        jQuery.ajax({
            url: "{:U('Search/ajax', array('do'=>'cat'))}",
            type: 'POST',
            dataType: 'json',
            data: {type: type, pid: pid, tp: tp},
            success: function(data, textStatus, xhr) {
                if (data['status'] == true) {
                    var list = data['data'];
                    var html = '<option value="0">请选择分类</option>';
                    for (var i = 0; list.length > i; i++) {
                        html += '<option value="' + list[i]['cat_id'] + '">' + list[i]['name'] + '</option> ';
                    }
                    if (sT == 1) {
                        $("select[name='cate_one']").html(html);
                        $("select[name='cate_one']").fadeIn();
                        $("#cat_one").fadeIn();
                        $("select[name='cate_two']").fadeOut();
                        $("#cat_two").fadeOut();
                    } else {
                        $("select[name='cate_two']").html(html);
                        $("select[name='cate_two']").fadeIn();
                        $("#cat_two").fadeIn();
                    }
                } else {
                    if (sT == 1) {
                        $("select[name='cate_one']").fadeOut();
                        $("select[name='cate_two']").fadeOut();
                        $("#cat_one").fadeOut();
                        $("#cat_two").fadeOut();
                    } else {
                        $("select[name='cate_two']").fadeOut();
                        $("#cat_two").fadeOut();
                    }
                }
            },
            error: function(xhr, textStatus, errorThrown) {
                //called when there is an error
            }
        });
    }
    function getLocalFormatTime(nS) {
        return new Date(parseInt(nS) * 1000).toLocaleString().replace(/年|月/g, "-").replace(/日/g, " ");
    }
</script>
<!---->